﻿namespace ChinaUnicom
{
    using System.IO.IsolatedStorage;

    public class ApplicationSettings
    {
        static IsolatedStorageSettings storage
        {
            get
            {
                return IsolatedStorageSettings.ApplicationSettings;
            }
        }

        static object locker = new object();

        private ApplicationSettings()
        {
        }

        static ApplicationSettings settings;
        public static ApplicationSettings Settings
        {
            get
            {
                if (settings == null)
                {
                    lock (locker)
                    {
                        settings = new ApplicationSettings();
                    }
                }

                return settings;
            }
        }
        
        public string this[string key]
        {
            get
            {
                if (!storage.Contains(key))
                {
                    return string.Empty;
                }

                return storage[key].ToString();
            }

            set
            {
                storage[key] = value;
            }
        }
    }
}
